#pragma once
#ifndef glutls_h_
#define glutls_h_


#include "../../inc/skyAdapter.h"
#include "../../inc/skyObject.h"

#ifdef _GLES_
#include "../thirdParty/win32/ogles/gles/gl.h"
#include "../thirdParty/win32/ogles/EGL/egl.h"
#include <windows.h>
namespace Sky
{
	
}

namespace GL
{
		
	/*!***********************************************************************
	@Function			IsGLExtensionSupported
	@Input				extension extension to query for
	@Returns			True if the extension is supported
	@Description		Queries for support of an extension
	*************************************************************************/
	bool IsGLExtensionSupported(const char *extension)
	{
		// The recommended technique for querying OpenGL extensions;
		// from http://opengl.org/resources/features/OGLextensions/
		const GLubyte *extensions = NULL;
		const GLubyte *start;
		GLubyte *where, *terminator;

		/* Extension names should not have spaces. */
		where = (GLubyte *) strchr(extension, ' ');
		if (where || *extension == '\0')
			return 0;

		extensions = glGetString(GL_EXTENSIONS);

		/* It takes a bit of care to be fool-proof about parsing the
		OpenGL extensions string. Don't be fooled by sub-strings, etc. */
		start = extensions;
		for (;;) {
			where = (GLubyte *) strstr((const char *) start, extension);
			if (!where)
				break;
			terminator = where + strlen(extension);
			if (where == start || *(where - 1) == ' ')
				if (*terminator == ' ' || *terminator == '\0')
					return true;
			start = terminator;
		}
		return false;
	}
}
#endif
#endif